/**
 * @author Chris Wilcox
 * @author Preston Parrett
 * 
 * @date 2008/03/17
 * 
 * The Evolution program was written for UCSB's CS165b class.
 * 
 */

package evolution;

import java.awt.Color;
import java.awt.Graphics;

public class Producer implements Life {
	
	// Please note thats plants DO NOT move
	// after they are created.
	private int row, col;
	private World home;
	
	public Producer(World world, int row, int col) {
		resetLocation(row,col);
		this.home = world;
		Stats.report("Number " + name(), 1);
	}
	
	public int[] location() {
		return new int[] { row, col } ;
	}
	
	public void resetLocation(int row, int col) {
		this.row = row;
		this.col = col;
	}

	
	public void eat(Life theMeal) throws RuntimeException {
		// NOT IMPLEMENTED: plants don't eat, silly!
		throw new RuntimeException("Not implemented: Plants do not eat!");
	}
	
	public int eaten() {
		die();
		return 500;
	}
	
	public void die() {
		Stats.report("Number " + name(), -1);
		home.remove(row,col);
	}
	
	public String name() {
		return "Producer";
	}
	
	/////////////////////////
	// GUI
	/////////////////////////
	public void draw(Graphics g, int row, int col, int cellSize) {
		g.setColor(Color.GREEN);
		g.fillOval((col - 1) * cellSize + 1, (row - 1) * cellSize + 1, cellSize - 3, cellSize - 3);
	}

	

	
}
